// dnsapi.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <malloc.h>
#pragma comment(lib,"Dnsapi.lib")
#pragma comment(lib,"ws2_32.lib")

int main(int argc, char* argv[])
{
    PDNS_RECORD set;
    PVOID re = malloc(1000);
    IP4_ARRAY ss;
    ss.AddrCount = 1;
    ss.AddrArray[0] = inet_addr("8.8.8.8");
    DNS_STATUS  stat = DnsQuery_W(L"www.facebook.com.",DNS_TYPE_A,DNS_QUERY_USE_TCP_ONLY|8,&ss,&set,0);
    while(set){
        printf("%S %s ttl:%d\n",set->pName, inet_ntoa( *((in_addr*)&(set->Data.A.IpAddress))),set->dwTtl );
        set = set->pNext;
    }
	return 0;
}
